home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 June / EnigmA AMIGA RUN 08 (1996)(G.R. Edizioni)(IT)[!][issue 1996-06][EARSAN CD VII].iso / earcd / comm1 / intsdkss.lha / examples / sockinit.c < prev   
C/C++ Source or Header  |  1996-04-09  |  560b  |  32 lines

  1. void __regargs __autoopenfail(char *);
  2.  
  3. #include <proto/exec.h>
  4. #include <ss/socket.h>
  5.  
  6. struct Library *SockBase;
  7. static void *libbase;
  8.  
  9. extern int errno;
  10.  
  11. int __stdargs _STI_opensock(void)
  12. {
  13.     SockBase = libbase = (void *)OpenLibrary("inet:libs/socket.library", 6);
  14.     if (SockBase == NULL)
  15.     {
  16.     __autoopenfail("inet:libs/socket.library");
  17.     return 1;
  18.     }
  19.     setup_sockets(FD_SETSIZE, &errno);
  20.     return 0;
  21. }
  22.  
  23. void __stdargs _STD_closesock(void)
  24. {
  25.     if (libbase)
  26.     {
  27.     cleanup_sockets();
  28.     CloseLibrary(libbase);
  29.     libbase = SockBase = NULL;
  30.     }
  31. }
  32.